package com.zk.service;

import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class CarService {
    /**
     * 读取颜色
     *
     * @return
     */
    public String getColor() {
        return "红色";
    }


    /**
     * 读取行驶距离
     *
     * @return
     */
    public int getMileage(Date date) {
        final Date sig = new Date(System.currentTimeMillis() - 1000 * 86400 * 365 * 3);
        if (date == null) {
            return 0;
        }
        if (date.after(sig)) {
            return 100000;
        } else {
            return 5000;
        }
    }

    public String getBrand(String carCode) {
        return "蔚来";
    }

    public String getOwner(String carCode, Date today) {
        return "张三";
    }

}
